home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: vijay.chinalake.navy.mil!user
- From: vijay@nawc690.chinalake.navy.mil (Jim Vijay)
- Subject: Passing multidimensional arrays to functions in C
- Message-ID: <vijay-2301961215460001@vijay.chinalake.navy.mil>
- Sender: usenet@avalon.chinalake.navy.mil (NAWS news admin)
- Organization: NAWC
- Date: Tue, 23 Jan 1996 20:13:31 GMT
-
- The C FAQ (Q's 6.16 thru 6.20) explains how to pass 2D arrays to functions
- in C. None of the methods shown is as simple or general as languages such
- as (gasp!) FORTRAN.
-
- While realizing that I'm inviting flames, and realizing this topic
- may have been discussed to death in the past (but not in the FAQ),
- let me ask:
-
- What would break (or even be damaged) in C if the language allowed
- one to pass the width of a 2D array (in general, n-1 dimensions of
- an n dim array) to a function? It should be easy for a compiler to
- emit code that dynamically depends on these n-1 dimensions.
- FORTRAN (IV?) at the time of C's birth could do it!
-
- Please note that I'm not asking how the C language defines and uses multi
- dimensional array parameters to functions. I would like to know _why_ the
- current mechanism was chosen - initially (by K&R?) and later by the ANSI
- C committees.
-
- Thanks.
-